package com.project.bean;

import com.fasterxml.jackson.annotation.JsonFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;
import java.util.List;

/**
 * 订单实体类
 *
 * @author lyl
 */
public class OrderBean {
    /**
     * 订单的编号
     */
    private int orderId;
    /**
     * 收货人姓名
     */
    @NotBlank(message = "收货人姓名不能为null")
    private String orderPeo;
    /**
     * 收货人地址
     */
    @Pattern(regexp = "[0-9\\u4e00-\\u9fa5]{5,}", message = "收货地址需为五位以上汉字或数字")
    private String orderLocation;
    /**
     * 收获人电话
     */
    @Pattern(regexp = "1[3578]\\d{9}", message = "电话需要为13，15，17，18开始的11位数")
    private String orderTel;
    /**
     * 订单现在的状态
     */
    private String orderStatue = "未发货";
    /**
     * 订单创建的时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate orderDate = LocalDate.now();
    /**
     * 下单用户
     */
    private UserBean userBean;
    /**
     * 订单明细集合
     */
    private List<OrderInfoBean> infoList;
    /**
     * 订单总金额
     */
    private int orderAllPrice;

    public OrderBean() {
    }

    public OrderBean(String orderPeo, String orderLocation, String orderTel, int orderAllPrice) {
        this.orderPeo = orderPeo;
        this.orderLocation = orderLocation;
        this.orderTel = orderTel;
        this.orderAllPrice = orderAllPrice;
    }

    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    public String getOrderPeo() {
        return orderPeo;
    }

    public void setOrderPeo(String orderPeo) {
        this.orderPeo = orderPeo;
    }

    public String getOrderLocation() {
        return orderLocation;
    }

    public void setOrderLocation(String orderLocation) {
        this.orderLocation = orderLocation;
    }

    public String getOrderTel() {
        return orderTel;
    }

    public void setOrderTel(String orderTel) {
        this.orderTel = orderTel;
    }

    public String getOrderStatue() {
        return orderStatue;
    }

    public void setOrderStatue(String orderStatue) {
        this.orderStatue = orderStatue;
    }

    public LocalDate getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(LocalDate orderDate) {
        this.orderDate = orderDate;
    }

    public UserBean getUserBean() {
        return userBean;
    }

    public void setUserBean(UserBean userBean) {
        this.userBean = userBean;
    }

    public List<OrderInfoBean> getInfoList() {
        return infoList;
    }

    public void setInfoList(List<OrderInfoBean> infoList) {
        this.infoList = infoList;
    }

    public int getOrderAllPrice() {
        return orderAllPrice;
    }

    public void setOrderAllPrice(int orderAllPrice) {
        this.orderAllPrice = orderAllPrice;
    }

    @Override
    public String toString() {
        return "OrderBean{" +
                "orderId=" + orderId +
                ", orderPeo='" + orderPeo + '\'' +
                ", orderLocation='" + orderLocation + '\'' +
                ", orderTel='" + orderTel + '\'' +
                ", orderStatue='" + orderStatue + '\'' +
                ", orderDate=" + orderDate +
                ", userBean=" + userBean +
                ", infoList=" + infoList +
                ", allPrice=" + orderAllPrice +
                '}' + "\n";
    }
}
